﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotNetCore.CAP;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MySql.Data.MySqlClient;

namespace CapSample.Controllers
{
    [Route("api/Tests/[action]")]
    [ApiController]
    public class TestsController : ControllerBase
    {
        private readonly ICapPublisher _capPublisher;
        public TestsController(ICapPublisher capPublisher)
        {
            _capPublisher = capPublisher;
        }
        public async Task SendCurrentTimeAsync()
        {
            //using (var myConn=new MySqlConnection(""))
            //{
            //    myConn.BeginTransaction(, true);
            //}
            await _capPublisher.PublishAsync("test", $"{DateTime.Now}gainorloss");
        }
        [CapSubscribe("test")]
        public void GetCurrentTime(string time)
        {
            var param = time;
        }
    }
}